Skip to content

Add GradStore::insert_id for inserting gradients by tensor ID#3038

Merged
ivarflakstad merged 1 commit into
huggingface:mainfrom
EthanAlmloff:gradstore_insert_id
Sep 6, 2025
Merged

Add GradStore::insert_id for inserting gradients by tensor ID#3038
ivarflakstad merged 1 commit into
huggingface:mainfrom
EthanAlmloff:gradstore_insert_id

Conversation

@EthanAlmloff

Copy link
Copy Markdown
Contributor

This PR adds a simple insert_id method to GradStore, allowing insertion of gradients directly by TensorId. This is motivated by #2962 on supporting gradient clipping. Without this function, it is impossible to clip gradients without access to the original Tensor instances.

@ivarflakstad ivarflakstad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ivarflakstad ivarflakstad merged commit 402782c into huggingface:main Sep 6, 2025
9 checks passed
john-sharratt pushed a commit to john-sharratt/candle that referenced this pull request May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants